#ifndef _TREE_
#define _TREE_

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "y.tab.h"

#define PLUS 300
#define MOINS 301
#define FOIS 302
#define DIVISE 303
#define MODULO 304
#define INF 305
#define SUP 306
#define NOT 307


struct tree
{
  int height;
  int op;
  struct tree *l, *r;
  union {
    int intval;        /* Constante entière */
    char *name;    /* Nom d'une variable */
  } val;
};

#define node_val val.intval
#define node_name val.name

struct tree * create_int(int op, int val);
struct tree * create_id(int op, char* name);
struct tree * build_tree(int op, struct tree *l, struct tree *r);
void display_tree(struct tree *t, int cpt);
//int balance(struct tree * t);
int compute_height(struct tree * t);

#endif
